//Header file for the Groovey Particle holder/handle class

#ifndef G_P_LIST
#define G_P_LIST

#include <list>
#include <boost/thread.hpp>
#include "gparticle_set.hpp"
#include "gparticle.hpp"

class GParticle_List{
    public:
    	GParticle_List();
    	
    	///pre: We need a list of real sets. This isn't a huge priority, but risky. Do try to feed the List some well defined sets or make sure they will be well defined soon.
    	
    	void Give(GParticle_Set& GPSet);						///result: The set of particles will be added 
    															/////////to the current set.
    	GParticle_Set& operator[](const int Index); 		///result: return a reference to a particle set
    	void Create(const GParticle& GPart, const int Amount); 	///result: create a set of particles of
    															/////////GPart in the amount of 'Amount'
    	int getSize() const;									///result: returns the quantity of sets
    	
    	bool Rendered();                    ///result: return the bool for rendered status
    	bool Updated();                     ///result: return the bool for updated status
    	boost::mutex& renderLock();			///result: Caller gets render access
    	void renderOpen();										///result: Caller gives up render access
    	boost::mutex& updateLock();			///result: Caller gets update access
    	void updateOpen();										///result: Caller gives up update access
    	
    	boost::condition& getRdyToRender();
    	boost::condition& getRdyToUpdate();
    	
    //////
	//////Privates:
	//////
    private:
    	std::list<GParticle_Set> p_sets;
    	
    	bool rendered, updated;
    	
    	boost::mutex renderAccess, updateAccess;
    	boost::condition rdyToRender, rdyToUpdate;
};

#endif
